package com.book.store.present.api;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
public class IndexApi {

    @Autowired
    private ApplicationContext appContext;

    @RequestMapping("api")
    public String index(){
        return String.format("%s running %s",appContext.getId(),new Date(appContext.getStartupDate()));
    }
}
